<%@ page language="java" pageEncoding="UTF-8" isELIgnored="false"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<jsp:include page="include_header.jsp" flush="false" />


<div class="status-panel clearfix">
	<div>
		[<a href="${pageContext.request.contextPath}/topics">首頁</a>]
	</div>
	<div>
		[<a href="${pageContext.request.contextPath}/composeMessage">發表新文章</a>]
	</div>
	<div>
		<select onchange="jumpToPage(this.value);">
			<c:forEach var="channel" items="${channels}">
				<option value="/topics?ch=${channel.key}">${channel.value}</option>
			</c:forEach>
		</select>
	</div>
</div>


<div>${usedTime}</div>


<!--Show topics-->
<div>
<ul>
	<c:forEach var="topic" items="${topics}">
		<li><a
			href="${pageContext.request.contextPath}/topic?id=${topic.messageId}&p=1">${topic.messageTitle}</a>
		<c:set var="pageCount" value="${topic.replies / 50}" /> <c:if
			test="${pageCount > 1}">
			<c:forEach var="index" begin="1" end="${pageCount + 1}">
				<a
					href="${pageContext.request.contextPath}/topic?id=${topic.messageId}&p=${index}">[${index}]</a>
			</c:forEach>
		</c:if> <br />
		${topic.authorName} (${topic.lastReplyDate}) (${topic.replies}個回覆) (評分:${topic.rating})</li>
	</c:forEach>
</ul>
</div>


<jsp:include page="include_footer.jsp" flush="false" />
